package com.example.transactionhintassistant.pojo.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 铃声表
 * @TableName ringtones
 */
@TableName(value ="ringtones")
@Data
public class Ringtone implements Serializable {
    /**
     * 铃声ID
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 铃声名称
     */
    private String ringtoneName;

    /**
     * 铃声文件
     */
    private String ringtoneFile;

    /**
     * 铃声时长
     */
    private Integer ringtoneDuration;

    /**
     * 创建日期
     */
//    @TableField(value = "create_date", fill = FieldFill.INSERT)
    private Date createdDate;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Ringtone other = (Ringtone) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getRingtoneName() == null ? other.getRingtoneName() == null : this.getRingtoneName().equals(other.getRingtoneName()))
            && (this.getRingtoneFile() == null ? other.getRingtoneFile() == null : this.getRingtoneFile().equals(other.getRingtoneFile()))
            && (this.getRingtoneDuration() == null ? other.getRingtoneDuration() == null : this.getRingtoneDuration().equals(other.getRingtoneDuration()))
            && (this.getCreatedDate() == null ? other.getCreatedDate() == null : this.getCreatedDate().equals(other.getCreatedDate()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getRingtoneName() == null) ? 0 : getRingtoneName().hashCode());
        result = prime * result + ((getRingtoneFile() == null) ? 0 : getRingtoneFile().hashCode());
        result = prime * result + ((getRingtoneDuration() == null) ? 0 : getRingtoneDuration().hashCode());
        result = prime * result + ((getCreatedDate() == null) ? 0 : getCreatedDate().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", ringtoneName=").append(ringtoneName);
        sb.append(", ringtoneFile=").append(ringtoneFile);
        sb.append(", ringtoneDuration=").append(ringtoneDuration);
        sb.append(", createdDate=").append(createdDate);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}